package com.enjoy.create.singleton;

public enum EnumSingleton {

    /**
     *
     */
    INSTANCE;


    private Singleton singleton = null;


    EnumSingleton() {
        this.singleton = new Singleton();
    }

    Singleton getInstance() {
        return singleton;
    }

    class Singleton {
        private Singleton() { }
        public void print() {
            System.out.println("打印数据");
        }
    }


    public static void main(String[] args) {

        Singleton instance1 = EnumSingleton.INSTANCE.getInstance();
        Singleton instance2 = EnumSingleton.INSTANCE.getInstance();

        System.out.println(instance1 == instance2);
    }
}
